package com.talking.presenter;

import com.talking.model.Http;

import org.json.JSONException;
import org.json.JSONObject;

import okhttp3.Callback;

public class MessagePresenter {
    public static void addMessage(String type, String senderAccount, String accepterAccount, JSONObject content, Callback callback){
        try {
            JSONObject jo= new JSONObject().put("type",type).put("senderAccount",senderAccount).put("accepterAccount",accepterAccount).put("content",content);
            Http.post(jo,"message/addMessage/",callback);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    public static void deleteMsg(String id, Callback callback) {
        Http.get("message/deleteMsg/?id="+id,callback);
    }
    public static void queryMsg(String account,Callback callback) {
        Http.get("message/queryMsg/?account="+account, callback);
    }
    public static void querySingle(String account,Callback callback) {
        Http.get("message/querySingle/?account="+account, callback);
    }
}
